package com.ljx.rbac.controller;

import com.ljx.rbac.annotation.ApiPermission;
import com.ljx.rbac.domain.entity.User;
import com.ljx.rbac.domain.vo.LoginReq;
import com.ljx.rbac.domain.vo.LoginResp;
import com.ljx.rbac.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-10-01  19:13
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @ApiPermission(permissions = {"123", "123123"})
    @GetMapping("/test")
    public void test(){
        System.out.println("测试");
    }

    @PostMapping("/login")
    public LoginResp login(@RequestBody LoginReq loginReq){
        return userService.login(loginReq);
    }

    @PostMapping("/register")
    public User register(@RequestBody LoginReq loginReq){
        return userService.register(loginReq);
    }


}
